package com.mornd.gulimall.apis.ware;

import com.mornd.gulimall.apis.ware.to.OrderLockStockResult;
import com.mornd.gulimall.apis.ware.to.SkusHasStockTo;
import com.mornd.gulimall.apis.ware.to.WareSkuLockTo;
import com.mornd.gulimall.common.core.result.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @author: mornd
 * @dateTime: 2023/8/9 - 16:13
 */

@Validated
@FeignClient(value = "service-ware")
public interface IWareClient {

    /**
     * 查询 sku 是否有库存
     *
     * @param ids
     * @return
     */
    @PostMapping("/ware/feign/getSkusHasStock")
    R<List<SkusHasStockTo>> getSkusHasStock(@RequestBody List<Long> ids);

    @PostMapping("/ware/feign/orderLockStock")
    R<OrderLockStockResult> orderLockStock(@RequestBody @Validated WareSkuLockTo wareSkuLockTo);

    @PostMapping("/ware/feign/orderLockStock2")
    R orderLockStock2(@RequestBody @Validated WareSkuLockTo wareSkuLockTo);
}
